#ifndef BAIDUOCR_H
#define BAIDUOCR_H

#include <QObject>
#include <QEventLoop>

class QNetworkAccessManager;

class BaiduOCR
{
public:
    static BaiduOCR& instance()
    {
        static BaiduOCR baiduOCR;
        return baiduOCR;
    }
    QString OCRTranslate(bool screenshot);
    QString OCRText(bool screenshot);

private:
    BaiduOCR();
    QEventLoop loop;
    QString imagePath;
    QNetworkAccessManager *manager;
private:
    QString access_token;
    bool getAccessTokenFromURL();
    bool checkAccessToken();
    QString getUrl(QString url_str);
};

#endif // BAIDUOCR_H
